def to_bool(value)
  "true".casecmp(value.to_s) == 0 || "yes".casecmp(value.to_s) == 0
end

def print_hash(f, hash)
  hash.each do |key, value|
    f.print "[#{key}]=[#{value}]\t"
  end
  f.puts
end

class Class
  def self.by_name(class_name)
    Object.const_get(class_name)
  end
end

class String
  def to_lowercase_underscore
    str = self.gsub(/[[:upper:]]/) do |s|
      '_' + s.downcase
    end
    str[0 .. 0] = "" if str[0 .. 0] == '_'
    str
  end
end



